import { firstValueFrom } from "rxjs/internal/firstValueFrom"
import { DynamicFormComponent } from "../dynamic-form.component"

export const afterSetFormData = async (that: DynamicFormComponent) => {
  console.log(that)
  // 联系人 && 更新
  if(that.typeId === '509ba753-e5da-4db4-8908-c12b54f21a31' && that.pageType === '1'){
    that._disable('name')
  }

  // 电子证照 实名认证
  if(that.authCode){
    const cardInfo =  await firstValueFrom(that.common.getCardNoByCode(that.authCode))
    if(cardInfo){
      that._setValue('userName', cardInfo.name)
      that._setValue('cardIdNum', cardInfo.cid)

      that._disable('userName')
      that._disable('cardIdNum')
    }
    console.log('cardInfo ===', cardInfo)
  }
  
}